<template>
  <div class="edit-page-wrap">
    <div class="company-info">
      <div class="info-item">
        注意事项：请在场站投运前，完成各项设置的初始化
      </div>
    </div>
    <el-tabs
      v-model="data.activeTab"
      class="demo-tabs"
      @tab-click="handleClickTab"
    >
      <el-tab-pane
        label="系统设置"
        name="system"
        v-if="bntAuth('systemSettingList.set')"
      >
        <Head title="经验值获取规则">
          <template #content>
            <el-form
              ref="ruleFormRef"
              :model="ruleForm"
              :rules="rules"
              label-width="140px"
              class="edit-form-wrap form-flex"
            >
              <el-form-item label="企业用户" prop="enterpriseDegree">
                <!-- <span style="margin-right: 10px">单次充电每满</span> -->
                <el-input
                  v-model.trim="ruleForm.enterpriseDegree"
                  placeholder="请输入"
                  maxlength="9"
                  style="width: 190px"
                >
                  <template #prepend>单次充电每满</template>
                  <template #append>度</template>
                </el-input>
                <!-- <span style="margin-left: 10px">度</span> -->
              </el-form-item>
              <el-form-item
                label=""
                prop="enterpriseExp"
                class="left-input"
                label-width="120px"
              >
                <el-input
                  v-model.trim="ruleForm.enterpriseExp"
                  placeholder="请输入"
                  maxlength="9"
                  style="width: 140px"
                >
                  <template #append>经验</template>
                </el-input>
                <!-- <span style="margin-left: 10px">经验</span> -->
              </el-form-item>
              <el-button
                type="primary"
                v-btnAntiShake="onSubmit"
                style="margin-left: 20px"
                >保存</el-button
              >
            </el-form>

            <el-form
              ref="ruleFormRef1"
              :model="ruleForm1"
              :rules="rules1"
              label-width="140px"
              class="edit-form-wrap form-flex"
            >
              <el-form-item label="非企业用户" prop="personDegree">
                <!-- <span style="margin-right: 10px">单次充电每满</span> -->

                <el-input
                  v-model.trim="ruleForm1.personDegree"
                  placeholder="请输入"
                  maxlength="9"
                  style="width: 190px"
                >
                  <template #prepend>单次充电每满</template>
                  <template #append>度</template>
                </el-input>
                <!-- <span style="margin-left: 10px">度</span> -->
              </el-form-item>
              <el-form-item
                label=""
                prop="personExp"
                class="left-input"
                label-width="120px"
              >
                <el-input
                  v-model.trim="ruleForm1.personExp"
                  placeholder="请输入"
                  maxlength="9"
                  style="width: 140px"
                >
                  <template #append>经验</template>
                </el-input>
                <!-- <span style="margin-left: 10px">经验</span> -->
              </el-form-item>
              <el-button
                type="primary"
                v-btnAntiShake="onSubmit1"
                style="margin-left: 20px"
                >保存</el-button
              >
            </el-form>
          </template>
        </Head>
        <div class="edit-line"></div>
        <Head title="充电设置">
          <template #content>
            <el-form
              ref="ruleFormRef2"
              :model="ruleForm2"
              :rules="rules2"
              label-width="140px"
              class="edit-form-wrap"
            >
              <el-form-item
                label="异常订单限制充电"
                prop="abnormalOrderAstrict"
                class="has-tips"
              >
                <el-switch
                  v-model="ruleForm2.abnormalOrderAstrict"
                  inactive-color="#d4dbf5"
                  @change="onSubmit2"
                ></el-switch>
                <span
                  style="margin-left: 10px"
                  v-if="ruleForm2.abnormalOrderAstrict"
                  >开启</span
                >
                <span style="margin-left: 10px" v-else>关闭</span>
                <div class="tip">
                  <div class="icon"></div>
                  开启：非一号多充用户有异常订单时，限制其启动新订单，关闭：不做限制
                </div>
              </el-form-item>
            </el-form>
          </template>
        </Head>
        <div class="edit-line"></div>
        <Head
          title='非企业用户设置（注：以下设置仅对非企业用户生效，企业用户可前往"企业管理"中分企业进行设置）'
        >
          <template #content>
            <el-form
              ref="ruleFormRef3"
              :model="ruleForm3"
              :rules="rules3"
              label-width="140px"
              class="edit-form-wrap"
            >
              <el-form-item
                label="充电阈值"
                prop="chargeThreshold"
                class="has-tips form-flex"
              >
                <el-input
                  v-model.trim="ruleForm3.chargeThreshold"
                  placeholder="请输入"
                  maxlength="11"
                  clearable
                >
                  <template #append>元</template>
                </el-input>
                <el-button
                  type="primary"
                  v-btnAntiShake="onSubmit3"
                  style="margin-left: 20px"
                  >保存</el-button
                >
                <div class="tip">
                  <div class="icon"></div>
                  用户账户余额低于设置的值，无法启动充电，充电中订单会自动停充
                </div>
              </el-form-item>
            </el-form>
            <el-form
              ref="ruleFormRef4"
              :model="ruleForm4"
              :rules="rules4"
              label-width="140px"
              class="edit-form-wrap"
            >
              <el-form-item
                label="占用是否实际扣费"
                prop="occupyIsFeeDeduction"
                class="has-tips"
              >
                <el-radio-group
                  v-model="ruleForm4.occupyIsFeeDeduction"
                  v-for="(item, index) in STATION_SITE"
                  :key="index"
                  @change="onSubmit4"
                >
                  <el-radio :label="item.value">{{ item.label }}</el-radio>
                </el-radio-group>
                <div class="tip">
                  <div class="icon"></div>
                  设置不扣费后，平台正常生成占位订单，但不实际扣取用户费用
                </div>
              </el-form-item>
              <el-form-item
                label="单笔扣费上限"
                prop="feeDeductionLimit"
                class="has-tips form-flex"
                v-if="ruleForm4.occupyIsFeeDeduction"
              >
                <el-input
                  v-model.trim="ruleForm4.feeDeductionLimit"
                  placeholder="请输入"
                  maxlength="11"
                  clearable
                >
                  <template #append>元</template>
                </el-input>
                <el-button
                  type="primary"
                  v-btnAntiShake="onSubmit4"
                  style="margin-left: 20px"
                  >保存</el-button
                >
                <div class="tip">
                  <div class="icon"></div>
                  示例：设置扣费上限为10元，单笔占用订单计费为20元时，仅收取用户10元费用
                </div>
              </el-form-item>
            </el-form>
          </template>
        </Head>
        <div class="edit-line"></div>
        <Head title="OCR配置">
          <template #content>
            <el-form
              ref="ruleFormRef5"
              :model="ruleForm5"
              :rules="rules5"
              label-width="140px"
              class="edit-form-wrap"
            >
              <el-form-item
                label="是否支持OCR识别"
                prop="ocrOpen"
                class="has-tips"
              >
                <el-switch
                  v-model="ruleForm5.ocrOpen"
                  inactive-color="#d4dbf5"
                  @change="onSubmit5"
                ></el-switch>
                <span style="margin-left: 10px" v-if="ruleForm5.ocrOpen"
                  >开启</span
                >
                <span style="margin-left: 10px" v-else>关闭</span>
              </el-form-item>
            </el-form>
            <el-form
              ref="ruleFormRef6"
              :model="ruleForm6"
              :rules="rules6"
              label-width="140px"
              class="edit-form-wrap"
              v-if="ruleForm5.ocrOpen"
            >
              <el-form-item label="appcode" prop="appcode">
                <el-input
                  v-model="ruleForm6.appcode"
                  placeholder="请输入"
                  maxlength="50"
                  clearable
                />
                <el-button
                  type="primary"
                  v-btnAntiShake="onSubmit6"
                  style="margin-left: 20px"
                  >保存</el-button
                >
              </el-form-item>
            </el-form>
          </template>
        </Head>
      </el-tab-pane>
      <el-tab-pane
        label="财务设置"
        name="financial"
        v-if="bntAuth('systemSettingList.finance')"
      >
        <Head title="开票设置">
          <template #content>
            <el-form
              ref="ruleFormRef7"
              :model="ruleForm7"
              :rules="rules7"
              label-width="140px"
              class="edit-form-wrap"
            >
              <el-form-item
                label="增值税专用发票"
                prop="vatSpecialInvoice"
                class="has-tips"
              >
                <el-switch
                  v-model="ruleForm7.vatSpecialInvoice"
                  inactive-color="#d4dbf7"
                  @change="onSubmit7"
                ></el-switch>
                <span
                  style="margin-left: 10px"
                  v-if="ruleForm7.vatSpecialInvoice"
                  >开启</span
                >
                <span style="margin-left: 10px" v-else>关闭</span>
                <div class="tip">
                  <div class="icon"></div>
                  开启：充电用户可选择申请开专票或普票，关闭：充电用户仅可选择申请开普票
                </div>
              </el-form-item>
            </el-form>
          </template>
        </Head>
        <div class="edit-line"></div>
        <Head title="互联互通（运营商、流量方）对账标准">
          <template #content>
            <el-form
              ref="ruleFormRef8"
              :model="ruleForm8"
              :rules="rules8"
              label-width="140px"
              class="edit-form-wrap form-flex"
            >
              <el-form-item
                label="需对账信息"
                prop="reconciliationInfo"
                class="has-tips"
              >
                <el-checkbox-group
                  v-model="ruleForm8.reconciliationInfo"
                  @change="handleChangeReconciliation"
                >
                  <el-checkbox
                    v-for="item in optionsS.interconnectivity"
                    :key="item.value"
                    :label="item.value"
                    :disabled="item.value == 1"
                    >{{ item.label }}</el-checkbox
                  >
                </el-checkbox-group>

                <div class="tip">
                  <div class="icon"></div>
                  选择需要进行对账的数据项，所选任意一项偏差超过偏差值，平台标识单笔订单为“未平账”订单
                </div>
              </el-form-item>
              <el-button
                type="primary"
                v-btnAntiShake="onSubmit8"
                style="margin-left: 20px"
                >保存</el-button
              >
            </el-form>
            <el-form
              ref="ruleFormRef9"
              :model="ruleForm9"
              :rules="rules9"
              label-width="140px"
              class="edit-form-wrap form-flex"
            >
              <el-form-item
                label="允许偏差值"
                prop="deviationAmount"
                class="has-tips"
              >
                <!-- <span style="margin-right: 10px">金额偏差</span> -->
                <el-input
                  v-model.trim="ruleForm9.deviationAmount"
                  placeholder="请输入"
                  maxlength="9"
                  style="width: 200px"
                >
                  <template #prepend>金额偏差</template>
                  <template #append>元</template>
                </el-input>
                <div class="tip">
                  <div class="icon"></div>
                  平台、互联互通双方的数值偏差在偏差值范围内，平台认定该笔订单平账
                </div>
              </el-form-item>
              <el-form-item
                label=""
                prop="deviationPower"
                class="has-tips left-input1"
                label-width="0px"
              >
                <el-input
                  v-model.trim="ruleForm9.deviationPower"
                  placeholder="请输入"
                  maxlength="9"
                  style="width: 200px"
                >
                  <template #prepend>电量偏差</template>
                  <template #append>度</template>
                </el-input>
              </el-form-item>
              <el-button
                type="primary"
                v-btnAntiShake="onSubmit9"
                style="margin-left: 20px"
                >保存</el-button
              >
            </el-form>
          </template>
        </Head>
      </el-tab-pane>
      <el-tab-pane
        label="短信设置"
        name="message"
        v-if="bntAuth('systemSettingList.sms')"
      >
        <Head title="短信开关">
          <template #content>
            <el-form
              ref="ruleFormRef10"
              :model="ruleForm10"
              :rules="rules10"
              label-width="140px"
              class="edit-form-wrap"
            >
              <el-form-item label="充电结束通知" prop="smsEndCharge">
                <el-switch
                  v-model="ruleForm10.smsEndCharge"
                  inactive-color="#d4dbf5"
                  @change="onSubmit10"
                ></el-switch>
                <span style="margin-left: 10px" v-if="ruleForm10.smsEndCharge"
                  >开启</span
                >
                <span style="margin-left: 10px" v-else>关闭</span>
              </el-form-item>
            </el-form>
          </template>
        </Head>
        <div class="edit-line"></div>
        <Head title="短信模板">
          <template #content>
            <div class="message-card">
              <div class="message-title">管理员接受短信</div>
              <el-form
                ref="ruleFormRef11"
                :model="ruleForm11"
                :rules="rules11"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="获取验证码" prop="adminSms">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm11.adminSms"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm11.adminSmsDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm11.adminSmsDisabled"
                    @click="editSms('11')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('11')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit11"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
            </div>
            <div class="message-card">
              <div class="message-title">充电用户接收短信</div>
              <el-form
                ref="ruleFormRef12"
                :model="ruleForm12"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="获取验证码" prop="userChargeGetCode">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm12.userChargeGetCode"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm12.userChargeGetCodeDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm12.userChargeGetCodeDisabled"
                    @click="editSms('12')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('12')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit12"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef13"
                :model="ruleForm13"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="充电结束通知" prop="userChargeEndInfo">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm13.userChargeEndInfo"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm13.userChargeEndInfoDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm13.userChargeEndInfoDisabled"
                    @click="editSms('13')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('13')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit13"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef14"
                :model="ruleForm14"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item
                  label="订单异常余额冻结"
                  prop="userChargeAbnormalOrder"
                >
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm14.userChargeAbnormalOrder"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm14.userChargeAbnormalOrderDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm14.userChargeAbnormalOrderDisabled"
                    @click="editSms('14')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('14')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit14"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef15"
                :model="ruleForm15"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item
                  label="异常停充短信通知"
                  prop="userChargeAbnormalCharge"
                >
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm15.userChargeAbnormalCharge"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm15.userChargeAbnormalChargeDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm15.userChargeAbnormalChargeDisabled"
                    @click="editSms('15')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('15')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit15"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef16"
                :model="ruleForm16"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item
                  label="用户连续启动失败"
                  prop="userChargeStartFail"
                >
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm16.userChargeStartFail"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm16.userChargeStartFailDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm16.userChargeStartFailDisabled"
                    @click="editSms('16')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('16')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit16"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
            </div>
            <div class="message-card">
              <div class="message-title">运维接收短信</div>
              <el-form
                ref="ruleFormRef17"
                :model="ruleForm17"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="枪线温度告警" prop="gunLineSms">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm17.gunLineSms"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm17.gunLineSmsDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm17.gunLineSmsDisabled"
                    @click="editSms('17')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('17')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit17"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef18"
                :model="ruleForm18"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="充电电压告警" prop="chargeVoltage">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm18.chargeVoltage"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm18.chargeVoltageDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm18.chargeVoltageDisabled"
                    @click="editSms('18')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('18')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit18"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef19"
                :model="ruleForm19"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="充电电流告警" prop="chargeCurrent">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm19.chargeCurrent"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm19.chargeCurrentDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm19.chargeCurrentDisabled"
                    @click="editSms('19')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('19')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit19"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef20"
                :model="ruleForm20"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item
                  label="输出功率不足告警"
                  prop="outputPowerDeficiency"
                >
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm20.outputPowerDeficiency"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm20.outputPowerDeficiencyDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm20.outputPowerDeficiencyDisabled"
                    @click="editSms('20')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('20')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit20"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef21"
                :model="ruleForm21"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="电桩离线告警" prop="equipmentOffLine">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm21.equipmentOffLine"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm21.equipmentOffLineDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm21.equipmentOffLineDisabled"
                    @click="editSms('21')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('21')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit21"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef22"
                :model="ruleForm22"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="电桩故障告警" prop="equipmentFailure">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm22.equipmentFailure"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm22.equipmentFailureDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm22.equipmentFailureDisabled"
                    @click="editSms('22')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('22')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit22"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef23"
                :model="ruleForm23"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item
                  label="设备连续启动失败"
                  prop="continuousStartStopFail"
                >
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm23.continuousStartStopFail"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm23.continuousStartStopFailDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm23.continuousStartStopFailDisabled"
                    @click="editSms('23')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('23')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit23"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef24"
                :model="ruleForm24"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item
                  label="电池电量监控告警"
                  prop="cellPowerMonitoring"
                >
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm24.cellPowerMonitoring"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm24.cellPowerMonitoringDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm24.cellPowerMonitoringDisabled"
                    @click="editSms('24')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('24')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit24"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef25"
                :model="ruleForm25"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="SOC过充告警" prop="overloadSoc">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm25.overloadSoc"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm25.overloadSocDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm25.overloadSocDisabled"
                    @click="editSms('25')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('25')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit25"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef26"
                :model="ruleForm26"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="电池温度监控告警" prop="cellTemperature">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm26.cellTemperature"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm26.cellTemperatureDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm26.cellTemperatureDisabled"
                    @click="editSms('26')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('26')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit26"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
              <el-form
                ref="ruleFormRef27"
                :model="ruleForm27"
                label-width="140px"
                class="edit-form-wrap"
              >
                <el-form-item label="账户阈值告警" prop="accountThreshold">
                  <el-input
                    class="message-textarea"
                    v-model.trim="ruleForm27.accountThreshold"
                    placeholder="请输入您在短信平台审核通过的模板ID"
                    maxlength="500"
                    type="textarea"
                    :disabled="ruleForm27.accountThresholdDisabled"
                    :rows="3"
                    show-word-limit
                    clearable
                  />
                  <div
                    class="card-edit"
                    v-if="ruleForm27.accountThresholdDisabled"
                    @click="editSms('27')"
                  >
                    <div class="iconfont icon-bianji">编辑</div>
                  </div>
                  <div class="card-save" v-else>
                    <div
                      class="iconfont icon-cuowuguanbiquxiao-xianxingyuankuang"
                      @click="editCancle('27')"
                    >
                      取消
                    </div>
                    <div
                      class="iconfont icon-baocun"
                      v-btnAntiShake="onSubmit27"
                    >
                      保存
                    </div>
                  </div>
                </el-form-item>
              </el-form>
            </div>
          </template>
        </Head>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
  
  <script lang="ts" setup>
import type { FormInstance, FormRules } from 'element-plus';
import Head from '@/components/head/index.vue';
import {
  IS_6TO2,
  IS_INT,
  IS_INT_0,
  IS_DECIMAL_2,
  IS_TWO_DECIMAL,
} from '@/utils/verify';
import {
  querySystemSettingsParameter,
  saveOrUpdateSystemSettingsParameter,
  querySystemSettingsFinance,
  addOrUpdateSystemSettingsFinance,
  querySystemSettingsSms,
  addOrUpdateSystemSettingsSms,
} from '@/service/apis/config';
import { STATION_SITE } from '@/utils/dictionaries';
import { queryDicByParent } from '@/service/apis/api';
import { bntAuth } from '@/utils/utils';

const router = useRouter();
const route = useRoute();
const ruleFormRef = ref<FormInstance>();
const ruleFormRef1 = ref<FormInstance>();
const ruleFormRef2 = ref<FormInstance>();
const ruleFormRef3 = ref<FormInstance>();
const ruleFormRef4 = ref<FormInstance>();
const ruleFormRef5 = ref<FormInstance>();
const ruleFormRef6 = ref<FormInstance>();
const ruleFormRef7 = ref<FormInstance>();
const ruleFormRef8 = ref<FormInstance>();
const ruleFormRef9 = ref<FormInstance>();
const ruleFormRef10 = ref<FormInstance>();
const ruleFormRef11 = ref<FormInstance>();
const ruleFormRef12 = ref<FormInstance>();
const ruleFormRef13 = ref<FormInstance>();
const ruleFormRef14 = ref<FormInstance>();
const ruleFormRef15 = ref<FormInstance>();
const ruleFormRef16 = ref<FormInstance>();
const ruleFormRef17 = ref<FormInstance>();
const ruleFormRef18 = ref<FormInstance>();
const ruleFormRef19 = ref<FormInstance>();
const ruleFormRef20 = ref<FormInstance>();
const ruleFormRef21 = ref<FormInstance>();
const ruleFormRef22 = ref<FormInstance>();
const ruleFormRef23 = ref<FormInstance>();
const ruleFormRef24 = ref<FormInstance>();
const ruleFormRef25 = ref<FormInstance>();
const ruleFormRef26 = ref<FormInstance>();
const ruleFormRef27 = ref<FormInstance>();

let optionsS = reactive({
  interconnectivity: [] as any,
});

const data = reactive({
  activeTab: 'system',
  ruleForm: {},
  ruleForm1: {},
});

let ruleForm: any = reactive({
  enterpriseDegree: '',
  enterpriseExp: '',
});

const rules = reactive<FormRules>({
  enterpriseDegree: [
    { required: false, message: '请输入企业用户充电度数', trigger: 'blur' },
    {
      pattern: IS_INT,
      message: '请输入大于0的正整数',
      trigger: 'blur',
    },
  ],
  enterpriseExp: [
    {
      required: false,
      message: '请输入企业用户充电对应经验值',
      trigger: 'blur',
    },
    {
      pattern: IS_INT_0,
      message: '请输入大于等于0的正整数',
      trigger: 'blur',
    },
  ],
});

const onSubmit = async () => {
  if (!ruleFormRef.value) return;
  try {
    await Promise.all([ruleFormRef.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm) {
      if (fields[key]) {
        ruleFormRef.value.scrollToField(key);
        break;
      }
    }
    return;
  }

  if (ruleForm.enterpriseDegree) {
    ruleForm.enterpriseDegree = Number(ruleForm.enterpriseDegree);
  }
  if (ruleForm.enterpriseExp) {
    ruleForm.enterpriseExp = Number(ruleForm.enterpriseExp);
  }
  const formData = Object.assign(ruleForm, data.ruleForm1);
  saveOrUpdateSystemSettingsParameter(formData).then((res: any) => {
    getSettingsParameter();
  });
};

let ruleForm1: any = reactive({
  personDegree: '',
  personExp: '',
});

const rules1 = reactive<FormRules>({
  personDegree: [
    { required: false, message: '请输入非企业用户充电度数', trigger: 'blur' },
    {
      pattern: IS_INT,
      message: '请输入大于0的正整数',
      trigger: 'blur',
    },
  ],
  personExp: [
    {
      required: false,
      message: '请输入非企业用户充电对应经验值',
      trigger: 'blur',
    },
    {
      pattern: IS_INT_0,
      message: '请输入大于等于0的正整数',
      trigger: 'blur',
    },
  ],
});

const onSubmit1 = async () => {
  if (!ruleFormRef1.value) return;
  try {
    await Promise.all([ruleFormRef1.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm) {
      if (fields[key]) {
        ruleFormRef1.value.scrollToField(key);
        break;
      }
    }
    return;
  }

  if (ruleForm1.personDegree) {
    ruleForm1.personDegree = Number(ruleForm1.personDegree);
  }
  if (ruleForm1.personExp) {
    ruleForm1.personExp = Number(ruleForm1.personExp);
  }
  const formData = Object.assign(ruleForm1, data.ruleForm);
  saveOrUpdateSystemSettingsParameter(formData).then((res: any) => {
    getSettingsParameter();
  });
};

// 异常订单限制充电 0: 表示未开启（否） 1:表示已开启（是）
let ruleForm2: any = reactive({
  abnormalOrderAstrict: false,
});

const rules2 = reactive<FormRules>({
  abnormalOrderAstrict: [
    { required: false, message: '请选择异常订单限制充电', trigger: 'change' },
  ],
});

const onSubmit2 = async () => {
  if (!ruleFormRef2.value) return;
  try {
    await Promise.all([ruleFormRef2.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm2) {
      if (fields[key]) {
        ruleFormRef2.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  saveOrUpdateSystemSettingsParameter(ruleForm2).then((res: any) => {});
};

let ruleForm3: any = reactive({
  chargeThreshold: '',
});

const rules3 = reactive<FormRules>({
  chargeThreshold: [
    { required: true, message: '请输入充电阈值', trigger: 'blur' },
    {
      pattern: IS_TWO_DECIMAL,
      message: '请输入正确的充电阈值，保留2位小数',
      trigger: 'blur',
    },
  ],
});

const onSubmit3 = async () => {
  if (!ruleFormRef3.value) return;
  try {
    await Promise.all([ruleFormRef3.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm3) {
      if (fields[key]) {
        ruleFormRef3.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  if (ruleForm3.chargeThreshold) {
    ruleForm3.chargeThreshold = Number(ruleForm3.chargeThreshold);
  }
  saveOrUpdateSystemSettingsParameter(ruleForm3).then((res: any) => {});
};

let ruleForm4: any = reactive({
  occupyIsFeeDeduction: false,
  feeDeductionLimit: '',
});

const rules4 = reactive<FormRules>({
  occupyIsFeeDeduction: [
    { required: false, message: '请选择占用是否实际扣费', trigger: 'change' },
  ],
  feeDeductionLimit: [
    { required: true, message: '请填写单笔扣费上限', trigger: 'blur' },
    {
      pattern: IS_DECIMAL_2,
      message: '请输入正确的单笔扣费上限，精确到2位小数',
      trigger: 'blur',
    },
  ],
});

const onSubmit4 = async () => {
  if (!ruleFormRef4.value) return;
  try {
    await Promise.all([ruleFormRef4.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm4) {
      if (fields[key]) {
        ruleFormRef4.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  if (ruleForm4.occupyIsFeeDeduction) {
    saveOrUpdateSystemSettingsParameter(ruleForm4).then((res: any) => {});
  } else {
    saveOrUpdateSystemSettingsParameter({
      occupyIsFeeDeduction: ruleForm4.occupyIsFeeDeduction,
    }).then((res: any) => {});
  }
};

let ruleForm5: any = reactive({
  ocrOpen: true,
});

const rules5 = reactive<FormRules>({
  ocrOpen: [
    { required: false, message: '请选择是否支持OCR识别', trigger: 'change' },
  ],
});

let ruleForm6: any = reactive({
  appcode: '',
});

const rules6 = reactive<FormRules>({
  appcode: [{ required: true, message: '请输入appcode', trigger: 'blur' }],
});

const onSubmit5 = async () => {
  if (!ruleFormRef5.value) return;
  try {
    await Promise.all([ruleFormRef5.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm5) {
      if (fields[key]) {
        ruleFormRef5.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  if (!ruleForm5.ocrOpen) {
    saveOrUpdateSystemSettingsParameter({
      ocrOpen: ruleForm5.ocrOpen,
      appcode: '',
    }).then((res: any) => {});
  }
};

const onSubmit6 = async () => {
  if (!ruleFormRef6.value) return;
  try {
    await Promise.all([ruleFormRef6.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm6) {
      if (fields[key]) {
        ruleFormRef6.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  saveOrUpdateSystemSettingsParameter({
    ocrOpen: ruleForm5.ocrOpen,
    appcode: ruleForm6.appcode,
  }).then((res: any) => {});
};

const back = () => {
  router.go(-1);
};

const getSettingsParameter = () => {
  querySystemSettingsParameter({}).then((res: any) => {
    if (res) {
      for (const key in ruleForm) {
        if (String(res[key])) {
          ruleForm[key] = res[key];
        }
      }
      data.ruleForm = {
        enterpriseDegree: res.enterpriseDegree,
        enterpriseExp: res.enterpriseExp,
      };
      for (const key in ruleForm1) {
        if (String(res[key])) {
          ruleForm1[key] = res[key];
        }
      }
      data.ruleForm1 = {
        personDegree: res.personDegree,
        personExp: res.personExp,
      };
      console.log(data.ruleForm1);

      for (const key in ruleForm2) {
        if (String(res[key])) {
          ruleForm2[key] = res[key];
        }
      }

      for (const key in ruleForm3) {
        if (String(res[key])) {
          ruleForm3[key] = res[key];
        }
      }

      for (const key in ruleForm4) {
        if (String(res[key])) {
          ruleForm4[key] = res[key];
        }
      }
      for (const key in ruleForm5) {
        if (String(res[key])) {
          ruleForm5[key] = res[key];
        }
      }
      for (const key in ruleForm6) {
        if (String(res[key])) {
          ruleForm6[key] = res[key];
        }
      }
    }
  });
};

getSettingsParameter();

let ruleForm7: any = reactive({
  vatSpecialInvoice: true,
});

const rules7 = reactive<FormRules>({
  vatSpecialInvoice: [
    {
      required: false,
      message: '请选择是否开启增值税专用发票',
      trigger: 'change',
    },
  ],
});

const onSubmit7 = async () => {
  if (!ruleFormRef7.value) return;
  try {
    await Promise.all([ruleFormRef7.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm7) {
      if (fields[key]) {
        ruleFormRef7.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsFinance(ruleForm7).then((res: any) => {});
};

let ruleForm8: any = reactive({
  reconciliationInfo: [1],
});

const rules8 = reactive<FormRules>({
  reconciliationInfo: [
    {
      required: false,
      message: '请勾选需对账信息',
      trigger: 'change',
    },
  ],
});
const handleChangeReconciliation = (e: any) => {
  ruleForm8.reconciliationInfo = e;
};

const onSubmit8 = async () => {
  if (!ruleFormRef8.value) return;
  try {
    await Promise.all([ruleFormRef8.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm8) {
      if (fields[key]) {
        ruleFormRef8.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsFinance({
    reconciliationInfo: ruleForm8.reconciliationInfo.join(','),
  }).then((res: any) => {});
};

let ruleForm9: any = reactive({
  deviationAmount: '',
  deviationPower: '',
});

const rules9 = reactive<FormRules>({
  deviationAmount: [
    { required: false, message: '请输入金额允许偏差值', trigger: 'blur' },
    {
      pattern: IS_6TO2,
      message: '金额允许偏差值（0.00~99999.99）',
      trigger: 'blur',
    },
  ],
  deviationPower: [
    {
      required: false,
      message: '请输入电量允许偏差值',
      trigger: 'blur',
    },
    {
      pattern: IS_6TO2,
      message: '电量允许偏差值（0.00~99999.99）',
      trigger: 'blur',
    },
  ],
});

const onSubmit9 = async () => {
  if (!ruleFormRef9.value) return;
  try {
    await Promise.all([ruleFormRef9.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm) {
      if (fields[key]) {
        ruleFormRef9.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  if (ruleForm9.deviationAmount) {
    ruleForm9.deviationAmount = Number(ruleForm9.deviationAmount);
  }
  if (ruleForm9.deviationPower) {
    ruleForm9.deviationPower = Number(ruleForm9.deviationPower);
  }
  addOrUpdateSystemSettingsFinance(ruleForm9).then((res: any) => {});
};

// 查询系统配置—财务配置
const getSettingsFinance = () => {
  querySystemSettingsFinance({}).then((res: any) => {
    if (res) {
      for (const key in ruleForm7) {
        if (String(res[key])) {
          ruleForm7[key] = res[key];
        }
      }

      ruleForm8.reconciliationInfo = res.reconciliationInfo.split(',');

      for (const key in ruleForm9) {
        if (String(res[key])) {
          ruleForm9[key] = res[key];
        }
      }
    }
  });
};

let ruleForm10: any = reactive({
  smsEndCharge: false,
});

const rules10 = reactive<FormRules>({
  smsEndCharge: [
    { required: false, message: '是否充电结束通知', trigger: 'change' },
  ],
});

const onSubmit10 = async () => {
  if (!ruleFormRef10.value) return;
  try {
    await Promise.all([ruleFormRef10.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm10) {
      if (fields[key]) {
        ruleFormRef10.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm10).then((res: any) => {});
};

let ruleForm11: any = reactive({
  adminSms: '',
  adminSmsDisabled: true,
});

const rules11 = reactive<FormRules>({
  adminSms: [
    { required: false, message: '是否充电结束通知', trigger: 'change' },
  ],
});

const onSubmit11 = async () => {
  if (!ruleFormRef11.value) return;
  try {
    await Promise.all([ruleFormRef11.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm11) {
      if (fields[key]) {
        ruleFormRef11.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms({ adminSms: ruleForm11.adminSms }).then(
    (res: any) => {
      ruleForm11.adminSmsDisabled = true;
    }
  );
};

let ruleForm12: any = reactive({
  userChargeGetCode: '',
  userChargeGetCodeDisabled: true,
});

const onSubmit12 = async () => {
  if (!ruleFormRef12.value) return;
  try {
    await Promise.all([ruleFormRef12.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm12) {
      if (fields[key]) {
        ruleFormRef12.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm12).then((res: any) => {
    ruleForm12.userChargeGetCodeDisabled = true;
  });
};

let ruleForm13: any = reactive({
  userChargeEndInfo: '',
  userChargeEndInfoDisabled: true,
});

const onSubmit13 = async () => {
  if (!ruleFormRef13.value) return;
  try {
    await Promise.all([ruleFormRef13.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm13) {
      if (fields[key]) {
        ruleFormRef13.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm13).then((res: any) => {
    ruleForm13.userChargeEndInfoDisabled = true;
  });
};

let ruleForm14: any = reactive({
  userChargeAbnormalOrder: '',
  userChargeAbnormalOrderDisabled: true,
});

const onSubmit14 = async () => {
  if (!ruleFormRef14.value) return;
  try {
    await Promise.all([ruleFormRef14.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm14) {
      if (fields[key]) {
        ruleFormRef14.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm14).then((res: any) => {
    ruleForm14.userChargeAbnormalOrderDisabled = true;
  });
};

let ruleForm15: any = reactive({
  userChargeAbnormalCharge: '',
  userChargeAbnormalChargeDisabled: true,
});

const onSubmit15 = async () => {
  if (!ruleFormRef15.value) return;
  try {
    await Promise.all([ruleFormRef15.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm15) {
      if (fields[key]) {
        ruleFormRef15.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm15).then((res: any) => {
    ruleForm15.userChargeAbnormalChargeDisabled = true;
  });
};

let ruleForm16: any = reactive({
  userChargeStartFail: '',
  userChargeStartFailDisabled: true,
});

const onSubmit16 = async () => {
  if (!ruleFormRef16.value) return;
  try {
    await Promise.all([ruleFormRef16.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm16) {
      if (fields[key]) {
        ruleFormRef16.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm16).then((res: any) => {
    ruleForm16.userChargeStartFailDisabled = true;
  });
};

let ruleForm17: any = reactive({
  gunLineSms: '',
  gunLineSmsDisabled: true,
});

const onSubmit17 = async () => {
  if (!ruleFormRef17.value) return;
  try {
    await Promise.all([ruleFormRef17.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm17) {
      if (fields[key]) {
        ruleFormRef17.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm17).then((res: any) => {
    ruleForm17.gunLineSmsDisabled = true;
  });
};

let ruleForm18: any = reactive({
  chargeVoltage: '',
  chargeVoltageDisabled: true,
});

const onSubmit18 = async () => {
  if (!ruleFormRef18.value) return;
  try {
    await Promise.all([ruleFormRef18.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm18) {
      if (fields[key]) {
        ruleFormRef18.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm18).then((res: any) => {
    ruleForm18.chargeVoltageDisabled = true;
  });
};

let ruleForm19: any = reactive({
  chargeCurrent: '',
  chargeCurrentDisabled: true,
});

const onSubmit19 = async () => {
  if (!ruleFormRef19.value) return;
  try {
    await Promise.all([ruleFormRef19.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm19) {
      if (fields[key]) {
        ruleFormRef19.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm19).then((res: any) => {
    ruleForm19.chargeCurrentDisabled = true;
  });
};

let ruleForm20: any = reactive({
  outputPowerDeficiency: '',
  outputPowerDeficiencyDisabled: true,
});

const onSubmit20 = async () => {
  if (!ruleFormRef20.value) return;
  try {
    await Promise.all([ruleFormRef20.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm20) {
      if (fields[key]) {
        ruleFormRef20.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm20).then((res: any) => {
    ruleForm20.outputPowerDeficiencyDisabled = true;
  });
};

let ruleForm21: any = reactive({
  equipmentOffLine: '',
  equipmentOffLineDisabled: true,
});

const onSubmit21 = async () => {
  console.log(ruleFormRef21.value);

  if (!ruleFormRef21.value) return;
  try {
    await Promise.all([ruleFormRef21.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm21) {
      if (fields[key]) {
        ruleFormRef21.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm21).then((res: any) => {
    ruleForm21.equipmentOffLineDisabled = true;
  });
};

let ruleForm22: any = reactive({
  equipmentFailure: '',
  equipmentFailureDisabled: true,
});

const onSubmit22 = async () => {
  console.log(ruleFormRef22.value);

  if (!ruleFormRef22.value) return;
  try {
    await Promise.all([ruleFormRef22.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm22) {
      if (fields[key]) {
        ruleFormRef22.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm22).then((res: any) => {
    ruleForm22.equipmentFailureDisabled = true;
  });
};

let ruleForm23: any = reactive({
  continuousStartStopFail: '',
  continuousStartStopFailDisabled: true,
});

const onSubmit23 = async () => {
  console.log(ruleFormRef23.value);

  if (!ruleFormRef23.value) return;
  try {
    await Promise.all([ruleFormRef23.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm23) {
      if (fields[key]) {
        ruleFormRef23.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm23).then((res: any) => {
    ruleForm23.continuousStartStopFailDisabled = true;
  });
};

let ruleForm24: any = reactive({
  cellPowerMonitoring: '',
  cellPowerMonitoringDisabled: true,
});

const onSubmit24 = async () => {
  console.log(ruleFormRef24.value);

  if (!ruleFormRef24.value) return;
  try {
    await Promise.all([ruleFormRef24.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm24) {
      if (fields[key]) {
        ruleFormRef24.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm24).then((res: any) => {
    ruleForm24.cellPowerMonitoringDisabled = true;
  });
};

let ruleForm25: any = reactive({
  overloadSoc: '',
  overloadSocDisabled: true,
});

const onSubmit25 = async () => {
  console.log(ruleFormRef25.value);

  if (!ruleFormRef25.value) return;
  try {
    await Promise.all([ruleFormRef25.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm25) {
      if (fields[key]) {
        ruleFormRef25.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm25).then((res: any) => {
    ruleForm25.overloadSocDisabled = true;
  });
};

let ruleForm26: any = reactive({
  cellTemperature: '',
  cellTemperatureDisabled: true,
});

const onSubmit26 = async () => {
  console.log(ruleFormRef26.value);

  if (!ruleFormRef26.value) return;
  try {
    await Promise.all([ruleFormRef26.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm26) {
      if (fields[key]) {
        ruleFormRef26.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm26).then((res: any) => {
    ruleForm26.cellTemperatureDisabled = true;
  });
};

let ruleForm27: any = reactive({
  accountThreshold: '',
  accountThresholdDisabled: true,
});

const onSubmit27 = async () => {
  console.log(ruleFormRef27.value);

  if (!ruleFormRef27.value) return;
  try {
    await Promise.all([ruleFormRef27.value.validate()]);
  } catch (fields: any) {
    for (const key in ruleForm27) {
      if (fields[key]) {
        ruleFormRef27.value.scrollToField(key);
        break;
      }
    }
    return;
  }
  addOrUpdateSystemSettingsSms(ruleForm27).then((res: any) => {
    ruleForm27.accountThresholdDisabled = true;
  });
};

// 编辑按钮
const editSms = (value: any) => {
  if (value === '11') {
    ruleForm11.adminSmsDisabled = false;
  } else if (value === '12') {
    ruleForm12.userChargeGetCodeDisabled = false;
  } else if (value === '13') {
    ruleForm13.userChargeEndInfoDisabled = false;
  } else if (value === '14') {
    ruleForm14.userChargeAbnormalOrderDisabled = false;
  } else if (value === '15') {
    ruleForm15.userChargeAbnormalChargeDisabled = false;
  } else if (value === '16') {
    ruleForm16.userChargeStartFailDisabled = false;
  } else if (value === '17') {
    ruleForm17.gunLineSmsDisabled = false;
  } else if (value === '18') {
    ruleForm18.chargeVoltageDisabled = false;
  } else if (value === '19') {
    ruleForm19.chargeCurrentDisabled = false;
  } else if (value === '20') {
    ruleForm20.outputPowerDeficiencyDisabled = false;
  } else if (value === '21') {
    ruleForm21.equipmentOffLineDisabled = false;
  } else if (value === '22') {
    ruleForm22.equipmentFailureDisabled = false;
  } else if (value === '23') {
    ruleForm23.continuousStartStopFailDisabled = false;
  } else if (value === '24') {
    ruleForm24.cellPowerMonitoringDisabled = false;
  } else if (value === '25') {
    ruleForm25.overloadSocDisabled = false;
  } else if (value === '26') {
    ruleForm26.cellTemperatureDisabled = false;
  } else if (value === '27') {
    ruleForm27.accountThresholdDisabled = false;
  }
};
// 取消按钮
const editCancle = (value: any) => {
  if (value === '11') {
    ruleForm11.adminSmsDisabled = true;
  } else if (value === '12') {
    ruleForm12.userChargeGetCodeDisabled = true;
  } else if (value === '13') {
    ruleForm13.userChargeEndInfoDisabled = true;
  } else if (value === '14') {
    ruleForm14.userChargeAbnormalOrderDisabled = true;
  } else if (value === '15') {
    ruleForm15.userChargeAbnormalChargeDisabled = true;
  } else if (value === '16') {
    ruleForm16.userChargeStartFailDisabled = true;
  } else if (value === '17') {
    ruleForm17.gunLineSmsDisabled = true;
  } else if (value === '18') {
    ruleForm18.chargeVoltageDisabled = true;
  } else if (value === '19') {
    ruleForm19.chargeCurrentDisabled = true;
  } else if (value === '20') {
    ruleForm20.outputPowerDeficiencyDisabled = true;
  } else if (value === '21') {
    ruleForm21.equipmentOffLineDisabled = true;
  } else if (value === '22') {
    ruleForm22.equipmentFailureDisabled = true;
  } else if (value === '23') {
    ruleForm23.continuousStartStopFailDisabled = true;
  } else if (value === '24') {
    ruleForm24.cellPowerMonitoringDisabled = true;
  } else if (value === '25') {
    ruleForm25.overloadSocDisabled = true;
  } else if (value === '26') {
    ruleForm26.cellTemperatureDisabled = true;
  } else if (value === '27') {
    ruleForm27.accountThresholdDisabled = true;
  }
  data.activeTab = 'message';
  getSettingsSms();
};

// 查询系统配置—短信配置
const getSettingsSms = () => {
  querySystemSettingsSms({}).then((res: any) => {
    if (res) {
      for (const key in ruleForm10) {
        if (String(res[key])) {
          ruleForm10[key] = res[key];
          console.log(ruleForm10[key]);
        }
      }

      for (const key in ruleForm11) {
        if (String(res[key])) {
          ruleForm11[key] = res[key];
          console.log(ruleForm11[key]);
        }
      }
      for (const key in ruleForm12) {
        if (String(res[key])) {
          ruleForm12[key] = res[key];
          console.log(ruleForm12[key]);
        }
      }
      for (const key in ruleForm13) {
        if (String(res[key])) {
          ruleForm13[key] = res[key];
          console.log(ruleForm13[key]);
        }
      }
      for (const key in ruleForm14) {
        if (String(res[key])) {
          ruleForm14[key] = res[key];
          console.log(ruleForm14[key]);
        }
      }
      for (const key in ruleForm15) {
        if (String(res[key])) {
          ruleForm15[key] = res[key];
          console.log(ruleForm15[key]);
        }
      }
      for (const key in ruleForm16) {
        if (String(res[key])) {
          ruleForm16[key] = res[key];
          console.log(ruleForm16[key]);
        }
      }
      for (const key in ruleForm17) {
        if (String(res[key])) {
          ruleForm17[key] = res[key];
          console.log(ruleForm17[key]);
        }
      }
      for (const key in ruleForm18) {
        if (String(res[key])) {
          ruleForm18[key] = res[key];
          console.log(ruleForm18[key]);
        }
      }
      for (const key in ruleForm19) {
        if (String(res[key])) {
          ruleForm19[key] = res[key];
          console.log(ruleForm19[key]);
        }
      }
      for (const key in ruleForm20) {
        if (String(res[key])) {
          ruleForm20[key] = res[key];
          console.log(ruleForm20[key]);
        }
      }
      for (const key in ruleForm21) {
        if (String(res[key])) {
          ruleForm21[key] = res[key];
          console.log(ruleForm21[key]);
        }
      }
      for (const key in ruleForm22) {
        if (String(res[key])) {
          ruleForm22[key] = res[key];
          console.log(ruleForm22[key]);
        }
      }
      for (const key in ruleForm23) {
        if (String(res[key])) {
          ruleForm23[key] = res[key];
          console.log(ruleForm23[key]);
        }
      }
      for (const key in ruleForm24) {
        if (String(res[key])) {
          ruleForm24[key] = res[key];
          console.log(ruleForm24[key]);
        }
      }
      for (const key in ruleForm25) {
        if (String(res[key])) {
          ruleForm25[key] = res[key];
          console.log(ruleForm25[key]);
        }
      }
      for (const key in ruleForm26) {
        if (String(res[key])) {
          ruleForm26[key] = res[key];
          console.log(ruleForm26[key]);
        }
      }
      for (const key in ruleForm27) {
        if (String(res[key])) {
          ruleForm27[key] = res[key];
          console.log(ruleForm27[key]);
        }
      }
      ruleForm11.adminSmsDisabled = true;
      ruleForm12.userChargeGetCodeDisabled = true;
      ruleForm13.userChargeEndInfoDisabled = true;
      ruleForm14.userChargeAbnormalOrderDisabled = true;
      ruleForm15.userChargeAbnormalChargeDisabled = true;
      ruleForm16.userChargeStartFailDisabled = true;
      ruleForm17.gunLineSmsDisabled = true;
      ruleForm18.chargeVoltageDisabled = true;
      ruleForm19.chargeCurrentDisabled = true;
      ruleForm20.outputPowerDeficiencyDisabled = true;
      ruleForm21.equipmentOffLineDisabled = true;
      ruleForm22.equipmentFailureDisabled = true;
      ruleForm23.continuousStartStopFailDisabled = true;
      ruleForm24.cellPowerMonitoringDisabled = true;
      ruleForm25.overloadSocDisabled = true;
      ruleForm26.cellTemperatureDisabled = true;
      ruleForm27.accountThresholdDisabled = true;
    }
  });
};

const handleClickTab = (e: any) => {
  console.log(e.props.name);
  if (e.props.name === 'system') {
    getSettingsParameter();
  } else if (e.props.name === 'financial') {
    getSettingsFinance();
  } else if (e.props.name === 'message') {
    getSettingsSms();
  }
};

queryDicByParent({
  listDtos: ['interconnectivityReconciliationStandard '],
}).then((res: any) => {
  if (res) {
    optionsS.interconnectivity = res.interconnectivityReconciliationStandard;
  }
});
</script>
  <style lang="scss">
.company-info {
  background: #c6e2ff;
  display: flex;
  padding: 10px;
  margin-top: 10px;
  .info-item {
    font-size: 14px;
    line-height: 28px;
    margin: 0 20px;
  }
}
.form-flex {
  display: flex;
  .left-input {
    margin-left: -120px;
  }
  .left-input1 {
    margin-left: -220px;
  }
}

.message-card {
  border: 1px solid var(--el-color-primary);
  padding: 14px 0;
  margin: 16px;
  .message-title {
    padding-left: 12px;
    font-size: 12px;
    font-weight: 500;
  }
  .message-textarea {
    width: 95% !important;
  }
  .icon-bianji,
  .icon-cuowuguanbiquxiao-xianxingyuankuang,
  .icon-baocun {
    color: var(--el-color-primary);
  }
  .card-edit {
    position: absolute;
    right: 5%;
    top: 0;
    margin-right: 10px;
    font-size: 12px;
    cursor: pointer;
  }
  .card-save {
    display: flex;
    position: absolute;
    right: 5%;
    top: 0;
    margin-right: 10px;
    cursor: pointer;
  }
  .icon-bianji,
  .icon-cuowuguanbiquxiao-xianxingyuankuang,
  .icon-baocun {
    font-size: 12px;
  }
  .icon-cuowuguanbiquxiao-xianxingyuankuang {
    margin-right: 10px;
  }
}
</style>